package com.sensePlusVR.widget.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

import com.sensePlusVR.base.BaseDialog;
import com.sensePlusVR.main.R;
import com.sensePlusVR.utils.EventBusUtils;
import com.sensePlusVR.utils.MyDialogUtil;
import com.sensePlusVR.utils.MyLog;

public class OpenCellularTipDialog extends BaseDialog implements OnClickListener {
	private static final String TAG = OpenCellularTipDialog.class.getSimpleName();
	private Context context;
	private ImageView open_cellular_del_iv;
	private Button open_cellular_ok;
	private Button open_cellular_cancel;
	
	public static final int TYPE_CELLULAR_OPENED = 1;
	public static final int TYPE_CELLULAR_CLOSED = 2;
	
	public OpenCellularTipDialog(Context context) {
		super(context,R.style.FullScreen_Dialog_Half_Tran);
		this.context = context;
		init();

	}

	public OpenCellularTipDialog(Context context, int theme) {
		super(context, theme);
		this.context = context;
		init();

	}
	
	private void init() {}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_open_cellular_tip);
		
		open_cellular_del_iv = (ImageView) findViewById(R.id.open_cellular_del_iv);
		open_cellular_ok = (Button) findViewById(R.id.open_cellular_ok);
		open_cellular_cancel = (Button) findViewById(R.id.open_cellular_cancel);

		open_cellular_del_iv.setOnClickListener(this);
		open_cellular_ok.setOnClickListener(this);
		open_cellular_cancel.setOnClickListener(this);
	}
	
	@Override
	public void show() {
		super.show();
		MyDialogUtil.setDialogFullScreen(context, this);
	}

	@Override
	public void onClick(View v) {
		int type = TYPE_CELLULAR_CLOSED;
		switch (v.getId()) {
		case R.id.open_cellular_del_iv:
			MyLog.d(TAG, "open_cellular_del_iv");
			type = TYPE_CELLULAR_CLOSED;
			break;
		case R.id.open_cellular_ok:
			MyLog.d(TAG, "open_cellular_ok");
			type = TYPE_CELLULAR_OPENED;
			break;
		case R.id.open_cellular_cancel:
			MyLog.d(TAG, "open_cellular_cancel");
			type = TYPE_CELLULAR_CLOSED;
			break;
		}
		EventBusUtils.onpenCellularDialogDismiss(type);
		dismiss();
	}

}
